/**
 * 
 * @Project le cOeur - Data Virtualization
 * @Date 08.12.2012
 * @Author Aebi Pascal, Kocher Marc
 * @School BFH-TI Biel, Bachelor Thesis
 *
 */

package main.framework.security;

import main.framework.exception.SecurityAccessException;

/**
 * The class WhiteList is used as holder of all hosts which are allowed to access the server.
 */
public class WhiteList extends AccessList {

	/**
	 * Creates a white list of hosts.
	 * This list holds all hosts which are ALLOWED to access the server.
	 * For all other hosts it is NOT ALLOWED to access the server.
	 * If the list is empty all hosts will be blocked. 
	 */
	public WhiteList() {
		super();
	}

	@Override
	public void checkAccessList(String host) throws SecurityAccessException {
		if(super.hosts.isEmpty() || !super.hosts.contains(host)){
			throw new SecurityAccessException("Access denied for host: " + host);
		}
	}

}
